/**
 * Created by wuliupai on 2017/6/27.
 */
import React, {Component} from 'react';
import {
    StyleSheet,
    Image,
} from 'react-native';

import {CMEMain} from './CMEMain';

export default class CMELaunch extends Component {

    constructor(props) {
        super(props);
        this.state = {
            flag: false,
            content: <Image
                source={{uri: 'launchimage'}}
                style={styles.launchImage}
            />,
        };
    }

    render() {
        return (
            this.state.flag ? <CMEMain/> : <Image
                source={{uri: 'launchimage'}}
                style={styles.launchImage}
            />

        );
    }

    // 耗时操作
    componentDidMount() {
        this.timer = setTimeout(
            ()=> {
                this.setState({
                    flag: true,
                });
            }, 300);
    }

    componentWillUnmount() {
        this.timer && clearTimeout(this.timer);
    }
}

const styles = StyleSheet.create({
    launchImage: {
        flex: 1,
    },
});